package com.pig4cloud.pigx.system.util;

import com.pig4cloud.pigx.system.enums.SystemLogEnum;
import org.springframework.stereotype.Component;

import java.util.Objects;

/**
 * 系统日志相关工具类
 *
 * @since 2022/12/12 15:51
 */
@Component
public class SystemLogUtil {

    /**
     * 根据当前用户是否为空判断
     *
     * @param user     用户
     * @param isClient 是否是用户
     * @return {@link String}
     * @since 2022/12/12 16:14
     */
    public static String getOperatorTypeByUser(Object user, boolean isClient) {
        return Objects.isNull(user) ?
                SystemLogEnum.OperatorType.SYSTEM.getValue()
                : isClient ?
                SystemLogEnum.OperatorType.CLIENT.getValue()
                : SystemLogEnum.OperatorType.MANAGER.getValue();
    }

}
